package com.yh.dao;


import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;

public class TestDemo {
    @Test
    public void test() throws Exception {

        ApplicationContext applicationContext = new
        ClassPathXmlApplicationContext("applicationContext.xml");
        DataSource dataSource = (DataSource)
        applicationContext.getBean("dataSource");
        Connection connection = dataSource.getConnection();
        System.out.println(connection);





//        ComboPooledDataSource dataSource = new ComboPooledDataSource("${jdbc.driver}");
//        dataSource.setJdbcUrl("${jdbc.url}");
//        dataSource.setUser("${jdbc.username}");
//        dataSource.setPassword("${jdbc.password}");
//        Connection connection = dataSource.getConnection();
//        System.out.println(connection);
    }

}